package com.android.settings.ios.view;

import android.view.View;

import com.android.settings.ios.R;

public class OsBackgroundUtil {

    public static void updateBackground(int mode, View view) {
        if (view == null) {
            return;
        }
        View line = view.findViewById(R.id.os_view_line);
        switch (mode) {
            case IOsPreference.MODE_TOP:
                view.setBackgroundResource(R.drawable.ip_os_preference_bg_top);
                if (line != null) {
                    line.setVisibility(View.VISIBLE);
                }
                break;
            case IOsPreference.MODE_BOTTOM:
                view.setBackgroundResource(R.drawable.ip_os_preference_bg_bottom);
                if (line != null) {
                    line.setVisibility(View.GONE);
                }
                break;
            case IOsPreference.MODE_SINGLE:
                view.setBackgroundResource(R.drawable.ip_os_preference_bg_single);
                if (line != null) {
                    line.setVisibility(View.GONE);
                }
                break;
            case IOsPreference.MODE_NONE:
                view.setBackgroundResource(R.drawable.ip_os_preference_bg_middle);
                if (line != null) {
                    line.setVisibility(View.VISIBLE);
                }
                break;
            default:
                view.setBackgroundResource(0);
                if (line != null) {
                    line.setVisibility(View.GONE);
                }
                break;
        }
    }
}
